<%@page import="classes.Courses"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import ="readFromDB.GetCourse" %>
<%@ page import ="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
<%	String StuID=String.valueOf((request.getSession().getAttribute("ID"))); %>
<meta charset="UTF-8">
<title>查看课表</title>
	<div">
    <span>位置：查看课表</span>
     <li><a href="http://localhost:8080/my_term_project_xuanke/student/student_home.jsp">返回主页</a>	</li>
     <li><a href="http://localhost:8080/my_term_project_xuanke/student/choose_course.jsp">选课</a>	</li>	
     <li><a href="http://localhost:8080/my_term_project_xuanke/student/myinfo.jsp">查个个人信息</a></li>
	 <li><a href="http://localhost:8080/my_term_project_xuanke/student/updatePW.jsp">修改密码</a></li>	
	 <li><a href="http://localhost:8080/my_term_project_xuanke/student/alter_phone.jsp">修改密保手机</a></li>
    <ul>
    </ul>
    </div>


		<%
		 request.setCharacterEncoding("UTF-8");
		 String message=String.valueOf((request.getSession().getAttribute("delete_course_message")));
	     message=message.replace("\n", " \\u000a");
	     String action ="http://localhost:8080/my_term_project_xuanke/studentServlet?action=delete";
		%>
<script src="http://localhost:8080/my_term_project_xuanke/resource/paging.js">>
		</script>
		<script type="text/javascript">
		var message='<%=message%>';
		if(message.length!=0&&message!="null"){
			alert(message);
		}
		
		</script>	
		<%//复原
			request.getSession().setAttribute("delete_course_message","");
		%>
</head>
 <body onLoad="goPage(1,10);">
<h1 align="center"><%=StuID %>同学选的课程</h1>	
   <form name="chooseCourses" action="<%=action%>" method="post">
<table id="show" border="1" align="center">
       <tr>
         <th>课程编号</th>
         <th>课程名称</th>
         <th>授课教师</th>
         <th>先修课</th>
         <th>上课时间</th>
		 <th>上课地点</th>	
		 <th>删除</th>		 
       </tr>
        <%
           GetCourse get=new GetCourse();
           List<Courses> list = get.getByTableName(StuID+"_course");  
           for(Courses course:list)
           {%>
         <tr>
              <td><%=course.getCuoId() %></td>
              <td><%=course.getCuoName() %></td>
              <td><%=course.getCuoTeacher()  %></td>
              <td><%=course.getCuoPro() %></td>
              <td><%=course.getCuoTime() %></td>
              <td><%=course.getCuoPosition() %></td>  
              <td><input type="checkbox" name="delete_this" value="<%=course.getCuoId() %>"/></td>   
           </tr>
             <%}
        %>
     </table>  
	<table align="right" style="margin:20px 400px 0px 20px">
     <tr><td> <div  id="barcon" name="barcon" ></div></td></tr>
	</table>
	
	
   <table  align="center" style="margin-top:60px">
      <tr>   <td><button type="submit">删除选中课程</button></td>       
      		<td><button><a href="http://localhost:8080/my_term_project_xuanke/student/schudule.jsp" >查看课表</a></button></td>       
      </tr>
   </table>
 </form>
</body>
</html>